pull: Add error prefixing for corrupt checksums
authorColin Walters <walters@verbum.org>
Wed, 14 Jun 2023 15:19:44 +0000 (11:19 -0400)
committerColin Walters <walters@verbum.org>
Wed, 14 Jun 2023 15:19:44 +0000 (11:19 -0400)
I got a bug report with the bare error
```
error: Invalid checksum of length 0 expected 32
```

And I'm pretty sure it's from here.  Add error prefixing so we
know exactly which metadata object was corrupt.

src/libostree/ostree-repo-pull.c

index 7c0598a8e1f77cf0148069c36536b03bc74b9760..0dd97664fba3b81cff9c1fdd28a9b997bb5fced5 100644 (file)
@@ -734,11 +734,11 @@ scan_dirtree_object (OtPullData *pull_data, const char *checksum, const char *pa
 
       const guchar *tree_csum_bytes = ostree_checksum_bytes_peek_validate (tree_csum, error);
       if (tree_csum_bytes == NULL)
-        return FALSE;
+        return glnx_prefix_error (error, "Parsing dirtree %s tree child %s", checksum, dirname);
 
       const guchar *meta_csum_bytes = ostree_checksum_bytes_peek_validate (meta_csum, error);
       if (meta_csum_bytes == NULL)
-        return FALSE;
+        return glnx_prefix_error (error, "Parsing dirtree %s meta child %s", checksum, dirname);
 
       g_autofree char *subpath = g_strconcat (path, dirname, "/", NULL);
       queue_scan_one_metadata_object_c (pull_data, tree_csum_bytes, OSTREE_OBJECT_TYPE_DIR_TREE,